<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
                 label-width="68px">
            <el-form-item label="工程名称" prop="gongchengName">
                <el-input v-model="queryParams.gongchengName" placeholder="请输入工程名称"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="商品id" prop="goodsId">
                <el-input v-model="queryParams.goodsId" placeholder="请输入商品id"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="产品名称" prop="goodsName">
                <el-input v-model="queryParams.goodsName" placeholder="请输入产品名称"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
                        <el-form-item label="合同交货日期" prop="deliveryTime">
                            <el-date-picker clearable v-model="queryParams.deliveryTime"
                                            type="date" value-format="yyyy-MM-dd" placeholder="请选择合同交货日期">
                            </el-date-picker>
                        </el-form-item>
            <el-form-item label="合同物料名称" prop="contractGoodsName">
                <el-input v-model="queryParams.contractGoodsName" placeholder="请输入合同物料名称"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="项目负责人" prop="chargePerson">
                <el-input v-model="queryParams.chargePerson" placeholder="请输入项目负责人"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="产品编码" prop="goodsCode">
                <el-input v-model="queryParams.goodsCode" placeholder="请输入产品编码"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="产品型号明细" prop="goodsBrand">
                <el-input v-model="queryParams.goodsBrand" placeholder="请输入产品型号明细"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="产品型号" prop="goodModel">
                <el-input v-model="queryParams.goodModel" placeholder="请输入产品型号"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="销售单价" prop="goodsUnitPrice">
                <el-input v-model="queryParams.goodsUnitPrice" placeholder="请输入销售单价"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="锁定数量" prop="lockCount">
                <el-input v-model="queryParams.lockCount" placeholder="请输入锁定数量"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="总价" prop="goodsTotalPrice">
                <el-input v-model="queryParams.goodsTotalPrice" placeholder="请输入总价"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="成本单价" prop="goodsBuyPrice">
                <el-input v-model="queryParams.goodsBuyPrice" placeholder="请输入成本单价"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="成本金额" prop="goodsBuyTotal">
                <el-input v-model="queryParams.goodsBuyTotal" placeholder="请输入成本金额"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="销售利润" prop="goodsProfit">
                <el-input v-model="queryParams.goodsProfit" placeholder="请输入销售利润"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="含税单价" prop="goodsTaxUnitPrice">
                <el-input v-model="queryParams.goodsTaxUnitPrice" placeholder="请输入含税单价"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="含税总价" prop="goodsTaxTotalPrice">
                <el-input v-model="queryParams.goodsTaxTotalPrice" placeholder="请输入含税总价"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="请购数量" prop="pleaseBuyCount">
                <el-input v-model="queryParams.pleaseBuyCount" placeholder="请输入请购数量"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="订单数量" prop="orderCount">
                <el-input v-model="queryParams.orderCount" placeholder="请输入订单数量"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
                        <el-form-item label="销售日期" prop="saleDate">
                            <el-date-picker clearable v-model="queryParams.saleDate"
                                            type="date" value-format="yyyy-MM-dd" placeholder="请选择销售日期">
                            </el-date-picker>
                        </el-form-item>
            <el-form-item label="供应商" prop="supplierId">
                <el-input v-model="queryParams.supplierId" placeholder="请输入供应商"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="供应商名称" prop="supplierName">
                <el-input v-model="queryParams.supplierName" placeholder="请输入供应商名称"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="客户" prop="customerId">
                <el-input v-model="queryParams.customerId" placeholder="请输入客户"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="客户名称" prop="customerName">
                <el-input v-model="queryParams.customerName" placeholder="请输入客户名称"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="是否开票" prop="invoice">
                <el-input v-model="queryParams.invoice" placeholder="请输入是否开票"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="发票id" prop="invoiceId">
                <el-input v-model="queryParams.invoiceId" placeholder="请输入发票id"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="发票编号" prop="invoiceNo">
                <el-input v-model="queryParams.invoiceNo" placeholder="请输入发票编号"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="是否回款" prop="fundCallback">
                <el-input v-model="queryParams.fundCallback" placeholder="请输入是否回款"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="是否打印签收单" prop="receipt">
                <el-input v-model="queryParams.receipt" placeholder="请输入是否打印签收单"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="销售人" prop="saleId">
                <el-input v-model="queryParams.saleId" placeholder="请输入销售人"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="销售人姓名" prop="saleName">
                <el-input v-model="queryParams.saleName" placeholder="请输入销售人姓名"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="订单编号" prop="projectId">
                <el-input v-model="queryParams.projectId" placeholder="请输入订单编号"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="订单名称" prop="projectName">
                <el-input v-model="queryParams.projectName" placeholder="请输入订单名称"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="订单编号" prop="projectNo">
                <el-input v-model="queryParams.projectNo" placeholder="请输入订单编号"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="部门ID" prop="deptId">
                <el-input v-model="queryParams.deptId" placeholder="请输入部门ID"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="部门名称" prop="deptName">
                <el-input v-model="queryParams.deptName" placeholder="请输入部门名称"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="是否发货'0'" prop="isfahuo">
                <el-input v-model="queryParams.isfahuo" placeholder="请输入是否发货'0'"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
                        <el-form-item label="发货时间" prop="fahuoDate">
                            <el-date-picker clearable v-model="queryParams.fahuoDate"
                                            type="date" value-format="yyyy-MM-dd" placeholder="请选择发货时间">
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item label="回款时间" prop="huikuanDate">
                            <el-date-picker clearable v-model="queryParams.huikuanDate"
                                            type="date" value-format="yyyy-MM-dd" placeholder="请选择回款时间">
                            </el-date-picker>
                        </el-form-item>
            <el-form-item label="产品编码" prop="code">
                <el-input v-model="queryParams.code" placeholder="请输入产品编码"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="是否自制(1:自制; 2:请购; 3:外协)" prop="isdo">
                <el-input v-model="queryParams.isdo" placeholder="请输入是否自制(1:自制; 2:请购; 3:外协)"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="已发货数量" prop="fahuoCount">
                <el-input v-model="queryParams.fahuoCount" placeholder="请输入已发货数量"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="剩余发货" prop="fahuoShengyu">
                <el-input v-model="queryParams.fahuoShengyu" placeholder="请输入剩余发货"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="请购单id" prop="lvdoId">
                <el-input v-model="queryParams.lvdoId" placeholder="请输入请购单id"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="请购单编号" prop="lvdoNo">
                <el-input v-model="queryParams.lvdoNo" placeholder="请输入请购单编号"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="工艺id" prop="gongyiId">
                <el-input v-model="queryParams.gongyiId" placeholder="请输入工艺id"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="工艺名称" prop="gongyiName">
                <el-input v-model="queryParams.gongyiName" placeholder="请输入工艺名称"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="工艺编号" prop="gongyiCode">
                <el-input v-model="queryParams.gongyiCode" placeholder="请输入工艺编号"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="工艺图纸" prop="gongyiPhoto">
                <el-input v-model="queryParams.gongyiPhoto" placeholder="请输入工艺图纸"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="工艺说明" prop="gongyiShuoming">
                <el-input v-model="queryParams.gongyiShuoming" placeholder="请输入工艺说明"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="工艺工序及分配任务状态" prop="state">
                <el-input v-model="queryParams.state" placeholder="请输入工艺工序及分配任务状态"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="入库数量" prop="rukuCount">
                <el-input v-model="queryParams.rukuCount" placeholder="请输入入库数量"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="未入库数量" prop="weiruCount">
                <el-input v-model="queryParams.weiruCount" placeholder="请输入未入库数量"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="合同收货人" prop="deliveryPerson">
                <el-input v-model="queryParams.deliveryPerson" placeholder="请输入合同收货人"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="${comment}" prop="rukumingxiId">
                <el-input v-model="queryParams.rukumingxiId" placeholder="请输入${comment}"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="${comment}" prop="rukumingxiNo">
                <el-input v-model="queryParams.rukumingxiNo" placeholder="请输入${comment}"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="是否拆解" prop="ischaijie">
                <el-input v-model="queryParams.ischaijie" placeholder="请输入是否拆解"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="排序" prop="sort">
                <el-input v-model="queryParams.sort" placeholder="请输入排序"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item label="项目单位" prop="projectDept">
                <el-input v-model="queryParams.projectDept" placeholder="请输入项目单位"
                        clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
                        v-hasPermi="['develop:GoodsSaleTowork:add']">新增</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single"
                        @click="handleUpdate" v-hasPermi="['develop:GoodsSaleTowork:edit']">修改</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-popconfirm title="确认删除选择的数据项？" @confirm="handleDelete({})">
                    <el-button slot="reference" type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
                               v-hasPermi="['develop:GoodsSaleTowork:remove']">删除</el-button>
                </el-popconfirm>
            </el-col>
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini"
                        @click="handleExport" v-hasPermi="['develop:GoodsSaleTowork:export']">导出</el-button>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>

        <el-table border v-loading="loading" :data="dataList" @selection-change="handleSelectionChange" ref="table" :max-height="tableMaxHeight">
            <el-table-column type="selection" width="55" align="center"/>
                    <el-table-column label="主键" align="center" prop="id"/>
            <el-table-column label="销售类别 (1:零散销售; 2:项目销售)" align="center" prop="type"/>
            <el-table-column label="工程名称" align="center" prop="gongchengName"/>
            <el-table-column label="商品id" align="center" prop="goodsId"/>
            <el-table-column label="产品名称" align="center" prop="goodsName"/>
                    <el-table-column label="合同交货日期" align="center" prop="deliveryTime" width="180">
                        <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.deliveryTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
                        </template>
                    </el-table-column>
            <el-table-column label="合同物料名称" align="center" prop="contractGoodsName"/>
            <el-table-column label="项目负责人" align="center" prop="chargePerson"/>
            <el-table-column label="产品编码" align="center" prop="goodsCode"/>
            <el-table-column label="产品类型 0-金具 1-产品" align="center" prop="goodsType"/>
            <el-table-column label="产品型号明细" align="center" prop="goodsBrand"/>
            <el-table-column label="产品型号" align="center" prop="goodModel"/>
            <el-table-column label="销售单价" align="center" prop="goodsUnitPrice"/>
            <el-table-column label="锁定数量" align="center" prop="lockCount"/>
            <el-table-column label="总价" align="center" prop="goodsTotalPrice"/>
            <el-table-column label="成本单价" align="center" prop="goodsBuyPrice"/>
            <el-table-column label="成本金额" align="center" prop="goodsBuyTotal"/>
            <el-table-column label="销售利润" align="center" prop="goodsProfit"/>
            <el-table-column label="含税单价" align="center" prop="goodsTaxUnitPrice"/>
            <el-table-column label="含税总价" align="center" prop="goodsTaxTotalPrice"/>
            <el-table-column label="请购数量" align="center" prop="pleaseBuyCount"/>
            <el-table-column label="订单数量" align="center" prop="orderCount"/>
                    <el-table-column label="销售日期" align="center" prop="saleDate" width="180">
                        <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.saleDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
                        </template>
                    </el-table-column>
            <el-table-column label="供应商" align="center" prop="supplierId"/>
            <el-table-column label="供应商名称" align="center" prop="supplierName"/>
            <el-table-column label="客户" align="center" prop="customerId"/>
            <el-table-column label="客户名称" align="center" prop="customerName"/>
            <el-table-column label="是否开票" align="center" prop="invoice"/>
            <el-table-column label="发票id" align="center" prop="invoiceId"/>
            <el-table-column label="发票编号" align="center" prop="invoiceNo"/>
            <el-table-column label="是否回款" align="center" prop="fundCallback"/>
            <el-table-column label="是否打印签收单" align="center" prop="receipt"/>
            <el-table-column label="销售人" align="center" prop="saleId"/>
            <el-table-column label="销售人姓名" align="center" prop="saleName"/>
            <el-table-column label="备注" align="center" prop="remark"/>
            <el-table-column label="订单编号" align="center" prop="projectId"/>
            <el-table-column label="订单名称" align="center" prop="projectName"/>
            <el-table-column label="订单编号" align="center" prop="projectNo"/>
            <el-table-column label="产品状态" align="center" prop="status"/>
            <el-table-column label="部门ID" align="center" prop="deptId"/>
            <el-table-column label="部门名称" align="center" prop="deptName"/>
            <el-table-column label="是否发货'0'" align="center" prop="isfahuo"/>
                    <el-table-column label="发货时间" align="center" prop="fahuoDate" width="180">
                        <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.fahuoDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="回款时间" align="center" prop="huikuanDate" width="180">
                        <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.huikuanDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
                        </template>
                    </el-table-column>
            <el-table-column label="产品编码" align="center" prop="code"/>
            <el-table-column label="是否自制(1:自制; 2:请购; 3:外协)" align="center" prop="isdo"/>
            <el-table-column label="已发货数量" align="center" prop="fahuoCount"/>
            <el-table-column label="剩余发货" align="center" prop="fahuoShengyu"/>
            <el-table-column label="请购单id" align="center" prop="lvdoId"/>
            <el-table-column label="请购单编号" align="center" prop="lvdoNo"/>
            <el-table-column label="工艺id" align="center" prop="gongyiId"/>
            <el-table-column label="工艺名称" align="center" prop="gongyiName"/>
            <el-table-column label="工艺编号" align="center" prop="gongyiCode"/>
            <el-table-column label="工艺文件" align="center" prop="gongyiFile"/>
            <el-table-column label="工艺图纸" align="center" prop="gongyiPhoto"/>
            <el-table-column label="工艺说明" align="center" prop="gongyiShuoming"/>
            <el-table-column label="工艺工序及分配任务状态" align="center" prop="state"/>
            <el-table-column label="巡检记录单" align="center" prop="xunjianFile"/>
            <el-table-column label="入库数量" align="center" prop="rukuCount"/>
            <el-table-column label="未入库数量" align="center" prop="weiruCount"/>
            <el-table-column label="合同收货人" align="center" prop="deliveryPerson"/>
            <el-table-column label="${comment}" align="center" prop="rukumingxiId"/>
            <el-table-column label="${comment}" align="center" prop="rukumingxiNo"/>
            <el-table-column label="是否拆解" align="center" prop="ischaijie"/>
            <el-table-column label="排序" align="center" prop="sort"/>
            <el-table-column label="采购类型" align="center" prop="caigouType"/>
            <el-table-column label="项目单位" align="center" prop="projectDept"/>
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-edit"
                            @click="handleUpdate(scope.row)" v-hasPermi="['develop:GoodsSaleTowork:edit']">修改</el-button>
                    <el-popconfirm :title="`确认删除当前数据项？`" @confirm="handleDelete(scope.row)"
                                   style="margin-left: 10px;">
                        <el-button slot="reference" size="mini" type="text" icon="el-icon-delete"
                                   v-hasPermi="['develop:GoodsSaleTowork:remove']">删除</el-button>
                    </el-popconfirm>
                </template>
            </el-table-column>
        </el-table>

        <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum"
                :limit.sync="queryParams.pageSize" @pagination="getList"/>

        <goodsSaleTowork-form ref="form" @ok="getList"></goodsSaleTowork-form>
    </div>
</template>

<script>
    import { deleteAction, getAction } from '@/api/manage'
    import GoodsSaleToworkForm from '@/views/develop/goodsSaleTowork/module/GoodsSaleToworkForm'

    export default {
        name: "GoodsSaleToworkList",
        components: {
            GoodsSaleToworkForm,
        },
        data() {
            return {
                // 遮罩层
                loading: true,
                // 选中数组
                ids: [],
                // 非单个禁用
                single: true,
                // 非多个禁用
                multiple: true,
                // 显示搜索条件
                showSearch: true,
                // 总条数
                total: 0,
                // 派工产品表格数据
                dataList: [],
                // 查询参数
                queryParams: {
                    pageNum: 1,
                    pageSize: 10,
            type: null,
            gongchengName: null,
            goodsId: null,
            goodsName: null,
            deliveryTime: null,
            contractGoodsName: null,
            chargePerson: null,
            goodsCode: null,
            goodsType: null,
            goodsBrand: null,
            goodModel: null,
            goodsUnitPrice: null,
            lockCount: null,
            goodsTotalPrice: null,
            goodsBuyPrice: null,
            goodsBuyTotal: null,
            goodsProfit: null,
            goodsTaxUnitPrice: null,
            goodsTaxTotalPrice: null,
            pleaseBuyCount: null,
            orderCount: null,
            saleDate: null,
            supplierId: null,
            supplierName: null,
            customerId: null,
            customerName: null,
            invoice: null,
            invoiceId: null,
            invoiceNo: null,
            fundCallback: null,
            receipt: null,
            saleId: null,
            saleName: null,
            projectId: null,
            projectName: null,
            projectNo: null,
            status: null,
            deptId: null,
            deptName: null,
            isfahuo: null,
            fahuoDate: null,
            huikuanDate: null,
            code: null,
            isdo: null,
            fahuoCount: null,
            fahuoShengyu: null,
            lvdoId: null,
            lvdoNo: null,
            gongyiId: null,
            gongyiName: null,
            gongyiCode: null,
            gongyiFile: null,
            gongyiPhoto: null,
            gongyiShuoming: null,
            state: null,
            xunjianFile: null,
            rukuCount: null,
            weiruCount: null,
            deliveryPerson: null,
            rukumingxiId: null,
            rukumingxiNo: null,
            ischaijie: null,
            sort: null,
            caigouType: null,
            projectDept: null
                },
                url: {
                    list:'/goodsSaleTowork/goodsSaleTowork/list',
                    remove:'/goodsSaleTowork/goodsSaleTowork/',
                    export:'/goodsSaleTowork/goodsSaleTowork/export',
                },
                tableMaxHeight: window.innerHeight - 320,
            };
        },
        created() {
            this.getList();
            window.addEventListener('resize', this.getTableHeight);
        },
        destroyed () {
            window.removeEventListener('resize', this.getTableHeight)
        },
        methods: {
            /** 查询派工产品列表 */
            getList() {
                this.loading = true;
                getAction(this.url.list, this.queryParams).then(response => {
                    this.dataList = response.rows;
                    this.total = response.total;
                    this.loading = false;
                });
            },
            getTableHeight () {
                this.tableHeight = window.innerHeight - 320
            },
            /** 搜索按钮操作 */
            handleQuery() {
                this.queryParams.pageNum = 1;
                this.getList();
            },
            /** 重置按钮操作 */
            resetQuery() {
                this.resetForm("queryForm");
                this.handleQuery();
            },
            // 多选框选中数据
            handleSelectionChange(selection) {
                this.ids = selection.map(item => item.id)
                this.single = selection.length !== 1
                this.multiple = !selection.length
            },
            /** 新增按钮操作 */
            handleAdd() {
                this.$refs.form.handleAdd();
            },
            /** 修改按钮操作 */
            handleUpdate(row) {
                this.$refs.form.handleUpdate(row);
            },
            /** 删除按钮操作 */
            handleDelete(row) {
                const ids = row.id || this.ids;
                deleteAction(this.url.remove, ids).then(response => {
                    this.getList();
                    this.$modal.msgSuccess("删除成功");
                }).catch(() => {});
            },
            /** 导出按钮操作 */
            handleExport() {
                this.download(this.url.export, {
                    ...this.queryParams
                }, `goodsSaleTowork_${new Date().getTime()}.xlsx`)
            },
  }
};
</script>
